/*
 *  Copyright (C) 2011  Clint Priest
 *
 *  This file is part of pklib.
 *
 *  pklib is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  pklib is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with pklib.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

var Commands = {
	RestartBrowser: function() {
		var iAppStartup = Components.interfaces.nsIAppStartup;
		Components.classes["@mozilla.org/toolkit/app-startup;1"]
			.getService(iAppStartup).quit(iAppStartup.eRestart | iAppStartup.eAttemptQuit);
	}
}

/** Install pklib commands and keys */
var CommandSet = document.querySelector('commandset');
if(CommandSet) {
	var Command = CreateAnonymousElement('<command id="cmd.pklib.Commands.RestartBrowser" oncommand="pklib.Commands.RestartBrowser()" />');
	CommandSet.appendChild(Command);
}

var Keyset = document.querySelector('keyset');
if(Keyset) {
	var Key = CreateAnonymousElement('<key id="key.pklib.Commands.RestartBrowser" modifiers="accel alt" key="R" command="cmd.pklib.Commands.RestartBrowser" />');
	Keyset.appendChild(Key);
}
